﻿using Microsoft.Xna.Framework.Graphics;
using OilRigSumoWrestlers.Controllables.Controllers;
using RaptorEngine;
using RaptorEngine.Components.Drawable;
using Microsoft.Xna.Framework;

namespace OilRigSumoWrestlers.Scenes.Menu
{
    public class SplashScreen:MenuScene
    {
        public SplashScreen() : base(false)
        {
            CreateScene();
            CreateController();
        }

        private void CreateController()
        {
            Entity splashController = new Entity();
            splashController.AddComponent(new SplashScreenController(splashController));
            AddEntity(splashController);
        }

        private void CreateScene()
        {
            int vpWidth = GameEngine.Instance.GraphicsDevice.Viewport.Width;
            int vpHeight = GameEngine.Instance.GraphicsDevice.Viewport.Height;

            // Background image
            Entity bgImage = new Entity();
            bgImage.AddComponent(new DrawableSprite(bgImage, GameEngine.Instance.Load<Texture2D>("Images/oilSplash-small")));
            bgImage.Scale = .8f;
                        
            DrawableSprite sprite = (DrawableSprite)bgImage.GetComponent(RaptorEngine.Components.ComponentType.Drawable2D);
            int textureWidth = sprite.Width;
            int textureHeight = sprite.Height;

            bgImage.Position = new Vector3((vpWidth / 2 - (textureWidth * bgImage.Scale) / 2), (vpHeight / 2 - (textureHeight * bgImage.Scale) / 2), 0);
            AddEntity(bgImage);

        }

        public override void Update()
        {
            
        }
    }
}
